import request from '@api/request';
import { HttpUrl } from '@api/httpUrl';

// 获取文件列表
export function getFileList(path: string) {
    return request.get<AjaxResponse['fileList']>(HttpUrl.getFileList, { params: { path } });
}

// 创建文件夹
export function createFolderApi(path: string, folderName: string) {
    return request.post(HttpUrl.createFolder, { path, folderName });  
}

// 复制文件
export function copyFileApi(copyFile: string, pasteFile: string) {
    return request.post(HttpUrl.copyFile, { copyFile, pasteFile });
}

// 移动文件
export function moveFileApi(moveFile: string, pasteFile: string) {
    return request.post(HttpUrl.moveFile, { moveFile, pasteFile });
}

// 重命名文件
export function renameFileApi(oldName: string, newName: string) {
    return request.post(HttpUrl.renameFile, { oldName, newName });
}

// 删除文件
export function deleteFileApi(deleteFile: string) {
    return request.post(HttpUrl.deleteFile, { deleteFile });
}
